/**
 *create by Jancheng ON 2019/9/11
 *
 * */
import OrbitControls from 'three-orbitcontrols';

function initControls(camera = null, domElement = null) {
  if (camera == null || domElement == null) {
    return null;
  }
  const controls = new OrbitControls(camera, domElement);
  // 是否有惯性
  controls.enableDamping = false;
  // 旋转速度
  controls.rotateSpeed = 0.1;
  // 缩放速度
  controls.zoomSpeed = 0.4;
  // 是否可以缩放
  controls.enableZoom = true;
  // 是否自动旋转
  controls.autoRotate = true;
  // 设置相机距离原点的最远距离
  controls.minDistance = 200;
  // 设置相机距离原点的最远距离
  controls.maxDistance = 600;
  controls.maxPolarAngle = 1;
  controls.minPolarAngle = 1;
  // 是否开启右键拖拽
  controls.enablePan = false;
  return controls;
}
export default {
  initControls,
};
